package com.pzb.goods.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pzb.goods.mapper.GdGoodsUnitsMapper;
import com.pzb.goods.domain.GdGoodsUnits;
import com.pzb.goods.service.IGdGoodsUnitsService;

/**
 * 规格属性Service业务层处理
 * 
 * @author Mr_Wu
 * @date 2021-11-30
 */
@Service
public class GdGoodsUnitsServiceImpl implements IGdGoodsUnitsService 
{
    @Autowired
    private GdGoodsUnitsMapper gdGoodsUnitsMapper;

    /**
     * 查询规格属性
     * 
     * @param id 规格属性主键
     * @return 规格属性
     */
    @Override
    public GdGoodsUnits selectGdGoodsUnitsById(Long id)
    {
        return gdGoodsUnitsMapper.selectGdGoodsUnitsById(id);
    }

    /**
     * 查询规格属性列表
     * 
     * @param gdGoodsUnits 规格属性
     * @return 规格属性
     */
    @Override
    public List<GdGoodsUnits> selectGdGoodsUnitsList(GdGoodsUnits gdGoodsUnits)
    {
        return gdGoodsUnitsMapper.selectGdGoodsUnitsList(gdGoodsUnits);
    }

    /**
     * 新增规格属性
     * 
     * @param gdGoodsUnits 规格属性
     * @return 结果
     */
    @Override
    public int insertGdGoodsUnits(GdGoodsUnits gdGoodsUnits)
    {
        return gdGoodsUnitsMapper.insertGdGoodsUnits(gdGoodsUnits);
    }

    /**
     * 修改规格属性
     * 
     * @param gdGoodsUnits 规格属性
     * @return 结果
     */
    @Override
    public int updateGdGoodsUnits(GdGoodsUnits gdGoodsUnits)
    {
        return gdGoodsUnitsMapper.updateGdGoodsUnits(gdGoodsUnits);
    }

    /**
     * 批量删除规格属性
     * 
     * @param ids 需要删除的规格属性主键
     * @return 结果
     */
    @Override
    public int deleteGdGoodsUnitsByIds(Long[] ids)
    {
        return gdGoodsUnitsMapper.deleteGdGoodsUnitsByIds(ids);
    }

    /**
     * 删除规格属性信息
     * 
     * @param id 规格属性主键
     * @return 结果
     */
    @Override
    public int deleteGdGoodsUnitsById(Long id)
    {
        return gdGoodsUnitsMapper.deleteGdGoodsUnitsById(id);
    }

    /**
     * 根据商品ID查询规格属性信息
     *
     * @param goodsId 规格属性主键
     * @return 结果
     */
    @Override
    public List<GdGoodsUnits> selectGdGoodsUnitsListByGoodsId(Long goodsId) {
        return gdGoodsUnitsMapper.selectGdGoodsUnitsListByGoodsId(goodsId);
    }

    /**
     * 根据商品ID删除规格属性信息
     *
     * @param goodsId 规格属性主键
     * @return 结果
     */
    @Override
    public int deleteGdGoodsUnitsByGoodsId(Long goodsId) {
        return gdGoodsUnitsMapper.deleteGdGoodsUnitsByGoodsId(goodsId);
    }

    @Override
    public GdGoodsUnits selectGoodsUnitsByGoodsIdAndUnits(Long goodsId, String goodsUnit) {
        return gdGoodsUnitsMapper.selectGoodsUnitsByGoodsIdAndUnits(goodsId,goodsUnit);
    }
}
